<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('动态成本')"/>
    <th:block th:include="include :: layout-latest-css"/>
    <th:block th:include="include :: ztree-css"/>
    <th:block th:include="include :: select2-css"/>
</head>
<style>
    select {
        padding-top: 3px !important;
    }

    .select-list {
        margin-top: 5px !important;
    }
</style>
<body class="gray-bg">
<div class="ui-layout-center">
    <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="dynamicCost-form">
                    <input type="hidden" id="companyId" name="companyId">
                    <input type="hidden" id="proId" name="proId">
                    <div class="col-sm-12">
                        <div class="select-list">
                            <ul>
                                <li>
                                    <p>工程公司：</p>
                                    <input class="form-control" type="text" name="compName">
                                </li>
                                <li>
                                    <p>项目名称：</p>
                                    <input class="form-control" type="text" name="proName">
                                </li>
                                <li>
                                    <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i
                                            class="fa fa-search"></i>&nbsp;搜索</a>
                                    <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i
                                            class="fa fa-refresh"></i>&nbsp;重置</a>
                                </li>
                            </ul>
                        </div>
                    </div>
                </form>
            </div>
            <div class="btn-group-sm" id="toolbar" role="group">
                <a class="btn btn-success" onclick="$.operate.add()">
                    <i class="fa fa-plus"></i> 新增
                </a>
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
</div>
<th:block th:include="include :: footer"/>
<th:block th:include="include :: select2-js"/>
<th:block th:include="include :: layout-latest-js"/>
<th:block th:include="include :: ztree-js"/>
<script th:inline="javascript">
    var prefix = ctx + "dynamicCost";

    $(function () {
        queryList();
    });

    function queryList() {
        var options = {
            uniqueId: "id",
            url: prefix + "/list",
            createUrl: prefix + "/add/{id}",
            updateUrl: prefix + "/edit/{id}",
            removeUrl: prefix + "/remove/{id}",
            modalName: "动态成本",
            columns: [{
                checkbox: true
            },
                {
                    field: 'compName',
                    title: '工程公司'
                },
                {
                    field: 'proName',
                    title: '项目名称'
                },
                {
                    field: 'years',
                    title: '年份'
                },
                {
                    field: 'months',
                    title: '月份'
                },
                {
                    field: 'planIncome',
                    title: '目标收入总额'
                },
                {
                    field: 'planCost',
                    title: '目标成本总额'
                },
                {
                    field: 'planProfitRate',
                    title: '策划利润率(%)'
                },
                {
                    field: 'IncomeChange',
                    title: '收入变动'
                },
                {
                    field: 'dynamicIncome',
                    title: '期末动态收入总额'
                },
                {
                    field: 'costChange',
                    title: '成本变动'
                },
                {
                    field: 'dynamicCost',
                    title: '期末动态成本总额'
                },
                {
                    field: 'dynamicProfitRate',
                    title: '动态利润率(%)'
                },
                {
                    title: '操作',
                    align: 'left',
                    formatter: function (value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                        actions.push('<a class="btn btn-danger btn-xs" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + ',' + row.sid + '\')"><i class="fa fa-remove"></i>删除</a> ');
                        return actions.join('');
                    }
                }]
        };
        $.table.init(options);
    }

</script>
</body>
</html>